package base2

import java.time.LocalDateTime

fun main() {
    val text = "  hello  "
    val trimmed = text.trim()  // 先去除首尾空格
        .takeIf { it.length >= 3 }  // 仅保留长度≥3的结果
        ?.uppercase()  // 转大写
    println(trimmed)  // 输出：HELLO（trim后长度5≥3）
}


//统一响应结构
fun uniResp() {
    println(Retn(200, "nil", "456").toString())
    println(Retn.ok(LocalDateTime.now()))
    println(Retn.err(-5, "err msg"))
    println(Retn.err(-5, "err msg").err)
}

fun readConsoleInput() {
    var exit = true
    while (exit) {
        val readln = readln()
        println(readln)
        if ("exit".equals(readln)) exit = false;
    }
    println("over")
}